<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/rect_top_corner_without_stroke"
    android:padding="@dimen/default_margins"
    tools:context=".ui.screens.main.CollectionDialogFragment">

    <ImageButton
        android:id="@+id/closeButton"
        android:layout_width="@dimen/film_details_action_button_size"
        android:layout_height="@dimen/film_details_action_button_size"
        android:scaleType="fitCenter"
        android:background="@null"
        android:contentDescription="@string/close_collection_dialog"
        android:src="@drawable/ic_close"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <Space
        android:id="@+id/topLine"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintEnd_toStartOf="@+id/closeButton"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/closeButton" />

    <ImageView
        android:id="@+id/filmImageView"
        android:layout_width="@dimen/film_item_width"
        android:layout_height="@dimen/film_item_height"
        android:contentDescription="@string/film_info_image"
        android:scaleType="centerCrop"
        android:src="@drawable/on_boarding_2"
        app:layout_constraintBottom_toTopOf="@id/midLine"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="@id/topLine" />

    <TextView
        android:id="@+id/ratingTextView"
        style="@style/film_item_rate"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintEnd_toEndOf="@id/filmImageView"
        app:layout_constraintTop_toTopOf="@id/filmImageView" />

    <TextView
        android:id="@+id/filmNameTextView"
        style="@style/film_category_name"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/_6sdp"
        android:ellipsize="end"
        android:maxLines="1"
        app:layout_constraintBottom_toBottomOf="@id/filmImageView"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toEndOf="@id/filmImageView"
        app:layout_constraintTop_toTopOf="@id/filmImageView"
        tools:text="@tools:sample/lorem/random" />

    <TextView
        android:id="@+id/filmGenreTextView"
        style="@style/film_item_genre"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/_6sdp"
        android:ellipsize="end"
        android:maxLines="1"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toEndOf="@id/filmImageView"
        app:layout_constraintTop_toBottomOf="@id/filmNameTextView"
        tools:text="@tools:sample/lorem/random" />

    <View
        android:id="@+id/midLine"
        android:layout_width="match_parent"
        android:layout_height="@dimen/_6sdp"
        android:background="?android:attr/listDivider"
        app:layout_constraintBottom_toTopOf="@id/addCollectionTextView"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/filmImageView" />


    <ImageView
        android:id="@+id/addCollectionImageView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_weight="1"
        android:src="@drawable/ic_add_collection"
        app:layout_constraintBottom_toBottomOf="@id/addCollectionTextView"
        app:layout_constraintEnd_toStartOf="@id/addCollectionTextView"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="@id/addCollectionTextView" />

    <TextView
        android:id="@+id/addCollectionTextView"
        style="@style/film_category_name"
        android:layout_width="wrap_content"
        app:layout_constraintHorizontal_bias="0.3"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_weight="3"
        android:text="@string/dialog_add_to_collection"
        app:layout_constraintBottom_toTopOf="@id/bottomLine"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/midLine" />

    <View
        android:id="@+id/bottomLine"
        android:layout_width="match_parent"
        android:layout_height="@dimen/_6sdp"
        android:background="?android:attr/listDivider"
        app:layout_constraintBottom_toTopOf="@id/collectionRecyclerView"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/addCollectionTextView" />

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/collectionRecyclerView"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:layout_marginHorizontal="@dimen/default_margins"
        android:orientation="vertical"
        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/bottomLine" />

</androidx.constraintlayout.widget.ConstraintLayout>
